package com.five.dao;

import com.five.pojo.ClubActivity;
import com.five.pojo.ClubRegister;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author lenovo
 */
@Mapper
public interface ClubActivityDao {
    @Select("select * from clubactivity")
    List<ClubActivity> getAllActivity();


    //@Select("select actName , actClub , actBeginTime , actSummarize , actPeople from clubactivity")
    List<ClubActivity> list2(String actName);

    @Insert("insert into clubregistrer(s_name , s_number , s_class , c_club) values " +
            "(#{sName} , #{sNumber} , #{sClass} , #{cClub})")
    void addRegisterInfo(ClubRegister clubRegister);

    @Select("select * from clubregistrer where s_name=#{sName}")
    String findByName(String name);

    @Delete("delete from clubactivity where id=#{id}")
    void deleteById(Integer id);

    @Insert("insert into clubactivity(act_name , act_summarize , act_particulars , act_people , act_time , act_club , act_ask , act_begintime , status)" +
            "values (#{actName} , #{actSummarize} , #{actParticulars} , #{actPeople} , #{actTime} , #{actClub} , #{actAsk} , #{actBeginTime} , #{status})")
    void addActivity(ClubActivity clubActivity);

    @Update("update clubactivity set status=#{status} where id=#{id}")
    void ModStatus(Integer status, Integer id);

    @Update("update clubregistrer set status=#{status} where id=#{id}")
    void ModStatus1(Integer status, Integer id);

    @Select("select count(*) as total from clubactivity")
    Integer getClubActivityTotal();

    @Select("select * from clubactivity where act_club=#{actClub}")
    List<ClubActivity> getByActClub(String actClub);

    @Update("update clubactivity set act_name=#{actName},act_summarize=#{actSummarize} , act_particulars=#{actParticulars} , act_people=#{actPeople} , act_time=#{actTime} , act_club=#{actClub} , act_ask=#{actAsk} , act_begintime=#{actBeginTime} , status=#{status} where id=#{id}")
    void updateActivity(ClubActivity clubActivity);
}
